#include "sm3_local.h"

int ossl_sm3_init(SM3_CTX *c) {
	memset(c, 0, sizeof(*c));
	c->A = SM3_A;
	c->B = SM3_B;
	c->C = SM3_C;
	c->D = SM3_D;
	c->E = SM3_E;
	c->F = SM3_F;
	c->G = SM3_G;
	c->H = SM3_H;
	return 1;
}

void ossl_sm3_block_data_order(SM3_CTX *ctx, const void *p, size_t num) {
	const unsigned char *data = p;
	register unsigned MD32_REG_T A, B, C, D, E, F, G, H;
	unsigned MD32_REG_T A1[65],B1[65],C1[65],D1[65],E1[65],F1[65],G1[65],H1[65];

	unsigned MD32_REG_T W00, W01, W02, W03, W04, W05, W06, W07, W08, W09, W10, W11, W12, W13, W14, W15;
	unsigned MD32_REG_T W[68];
	int i;

	for (; num--;) {

		A = ctx->A;
		B = ctx->B;
		C = ctx->C;
		D = ctx->D;
		E = ctx->E;
		F = ctx->F;
		G = ctx->G;
		H = ctx->H;
		/*
		* We have to load all message bytes immediately since SM3 reads
		* them slightly out of order.
		*/
		(void)HOST_c2l(data, W00);
		(void)HOST_c2l(data, W01);
		(void)HOST_c2l(data, W02);
		(void)HOST_c2l(data, W03);
		(void)HOST_c2l(data, W04);
		(void)HOST_c2l(data, W05);
		(void)HOST_c2l(data, W06);
		(void)HOST_c2l(data, W07);
		(void)HOST_c2l(data, W08);
		(void)HOST_c2l(data, W09);
		(void)HOST_c2l(data, W10);
		(void)HOST_c2l(data, W11);
		(void)HOST_c2l(data, W12);
		(void)HOST_c2l(data, W13);
		(void)HOST_c2l(data, W14);
		(void)HOST_c2l(data, W15);
		W[0]=W00;
		W[1]=W01;
		W[2]=W02;
		W[3]=W03;
		W[4]=W04;
		W[5]=W05;
		W[6]=W06;
		W[7]=W07;
		W[8]=W08;
		W[9]=W09;
		W[10]=W10;
		W[11]=W11;
		W[12]=W12;
		W[13]=W13;
		W[14]=W14;
		W[15]=W15;

		printf("\n填充后的消息：\n");
		for(i=0; i<16; i++) {
			printf("%08x ",W[i]);
			if(i%8==7) printf("\n");
		}


		A1[0]=A;
		B1[0]=B;
		C1[0]=C;
		D1[0]=D;
		E1[0]=E;
		F1[0]=F;
		G1[0]=G;
		H1[0]=H;
		R1(A, B, C, D, E, F, G, H, 0x79CC4519, W00, W00 ^ W04);
		W00 = EXPAND(W00, W07, W13, W03, W10);
		A1[1]=D;
		B1[1]=A;
		C1[1]=B;
		D1[1]=C;
		E1[1]=H;
		F1[1]=E;
		G1[1]=F;
		H1[1]=G;
		R1(D, A, B, C, H, E, F, G, 0xF3988A32, W01, W01 ^ W05);
		W01 = EXPAND(W01, W08, W14, W04, W11);
		A1[2]=C;
		B1[2]=D;
		C1[2]=A;
		D1[2]=B;
		E1[2]=G;
		F1[2]=H;
		G1[2]=E;
		H1[2]=F;
		R1(C, D, A, B, G, H, E, F, 0xE7311465, W02, W02 ^ W06);
		W02 = EXPAND(W02, W09, W15, W05, W12);
		A1[3]=B;
		B1[3]=C;
		C1[3]=D;
		D1[3]=A;
		E1[3]=F;
		F1[3]=G;
		G1[3]=H;
		H1[3]=E;
		R1(B, C, D, A, F, G, H, E, 0xCE6228CB, W03, W03 ^ W07);
		W03 = EXPAND(W03, W10, W00, W06, W13);
		A1[4]=A;
		B1[4]=B;
		C1[4]=C;
		D1[4]=D;
		E1[4]=E;
		F1[4]=F;
		G1[4]=G;
		H1[4]=H;
		R1(A, B, C, D, E, F, G, H, 0x9CC45197, W04, W04 ^ W08);
		W04 = EXPAND(W04, W11, W01, W07, W14);
		A1[5]=D;
		B1[5]=A;
		C1[5]=B;
		D1[5]=C;
		E1[5]=H;
		F1[5]=E;
		G1[5]=F;
		H1[5]=G;
		R1(D, A, B, C, H, E, F, G, 0x3988A32F, W05, W05 ^ W09);
		W05 = EXPAND(W05, W12, W02, W08, W15);
		A1[6]=C;
		B1[6]=D;
		C1[6]=A;
		D1[6]=B;
		E1[6]=G;
		F1[6]=H;
		G1[6]=E;
		H1[6]=F;
		R1(C, D, A, B, G, H, E, F, 0x7311465E, W06, W06 ^ W10);
		W06 = EXPAND(W06, W13, W03, W09, W00);
		A1[7]=B;
		B1[7]=C;
		C1[7]=D;
		D1[7]=A;
		E1[7]=F;
		F1[7]=G;
		G1[7]=H;
		H1[7]=E;
		R1(B, C, D, A, F, G, H, E, 0xE6228CBC, W07, W07 ^ W11);
		W07 = EXPAND(W07, W14, W04, W10, W01);
		A1[8]=A;
		B1[8]=B;
		C1[8]=C;
		D1[8]=D;
		E1[8]=E;
		F1[8]=F;
		G1[8]=G;
		H1[8]=H;
		R1(A, B, C, D, E, F, G, H, 0xCC451979, W08, W08 ^ W12);
		W08 = EXPAND(W08, W15, W05, W11, W02);
		A1[9]=D;
		B1[9]=A;
		C1[9]=B;
		D1[9]=C;
		E1[9]=H;
		F1[9]=E;
		G1[9]=F;
		H1[9]=G;
		R1(D, A, B, C, H, E, F, G, 0x988A32F3, W09, W09 ^ W13);
		W09 = EXPAND(W09, W00, W06, W12, W03);
		A1[10]=C;
		B1[10]=D;
		C1[10]=A;
		D1[10]=B;
		E1[10]=G;
		F1[10]=H;
		G1[10]=E;
		H1[10]=F;
		R1(C, D, A, B, G, H, E, F, 0x311465E7, W10, W10 ^ W14);
		W10 = EXPAND(W10, W01, W07, W13, W04);
		A1[11]=B;
		B1[11]=C;
		C1[11]=D;
		D1[11]=A;
		E1[11]=F;
		F1[11]=G;
		G1[11]=H;
		H1[11]=E;
		R1(B, C, D, A, F, G, H, E, 0x6228CBCE, W11, W11 ^ W15);
		W11 = EXPAND(W11, W02, W08, W14, W05);
		A1[12]=A;
		B1[12]=B;
		C1[12]=C;
		D1[12]=D;
		E1[12]=E;
		F1[12]=F;
		G1[12]=G;
		H1[12]=H;
		R1(A, B, C, D, E, F, G, H, 0xC451979C, W12, W12 ^ W00);
		W12 = EXPAND(W12, W03, W09, W15, W06);
		A1[13]=D;
		B1[13]=A;
		C1[13]=B;
		D1[13]=C;
		E1[13]=H;
		F1[13]=E;
		G1[13]=F;
		H1[13]=G;
		R1(D, A, B, C, H, E, F, G, 0x88A32F39, W13, W13 ^ W01);
		W13 = EXPAND(W13, W04, W10, W00, W07);
		A1[14]=C;
		B1[14]=D;
		C1[14]=A;
		D1[14]=B;
		E1[14]=G;
		F1[14]=H;
		G1[14]=E;
		H1[14]=F;
		R1(C, D, A, B, G, H, E, F, 0x11465E73, W14, W14 ^ W02);
		W14 = EXPAND(W14, W05, W11, W01, W08);
		A1[15]=B;
		B1[15]=C;
		C1[15]=D;
		D1[15]=A;
		E1[15]=F;
		F1[15]=G;
		G1[15]=H;
		H1[15]=E;
		R1(B, C, D, A, F, G, H, E, 0x228CBCE6, W15, W15 ^ W03);
		W15 = EXPAND(W15, W06, W12, W02, W09);
		W[16]=W00;
		W[17]=W01;
		W[18]=W02;
		W[19]=W03;
		W[20]=W04;
		W[21]=W05;
		W[22]=W06;
		W[23]=W07;
		W[24]=W08;
		W[25]=W09;
		W[26]=W10;
		W[27]=W11;
		W[28]=W12;
		W[29]=W13;
		W[30]=W14;
		W[31]=W15;


		A1[16]=A;
		B1[16]=B;
		C1[16]=C;
		D1[16]=D;
		E1[16]=E;
		F1[16]=F;
		G1[16]=G;
		H1[16]=H;
		R2(A, B, C, D, E, F, G, H, 0x9D8A7A87, W00, W00 ^ W04);
		W00 = EXPAND(W00, W07, W13, W03, W10);
		A1[17]=D;
		B1[17]=A;
		C1[17]=B;
		D1[17]=C;
		E1[17]=H;
		F1[17]=E;
		G1[17]=F;
		H1[17]=G;
		R2(D, A, B, C, H, E, F, G, 0x3B14F50F, W01, W01 ^ W05);
		W01 = EXPAND(W01, W08, W14, W04, W11);
		A1[18]=C;
		B1[18]=D;
		C1[18]=A;
		D1[18]=B;
		E1[18]=G;
		F1[18]=H;
		G1[18]=E;
		H1[18]=F;
		R2(C, D, A, B, G, H, E, F, 0x7629EA1E, W02, W02 ^ W06);
		W02 = EXPAND(W02, W09, W15, W05, W12);
		A1[19]=B;
		B1[19]=C;
		C1[19]=D;
		D1[19]=A;
		E1[19]=F;
		F1[19]=G;
		G1[19]=H;
		H1[19]=E;
		R2(B, C, D, A, F, G, H, E, 0xEC53D43C, W03, W03 ^ W07);
		W03 = EXPAND(W03, W10, W00, W06, W13);
		A1[20]=A;
		B1[20]=B;
		C1[20]=C;
		D1[20]=D;
		E1[20]=E;
		F1[20]=F;
		G1[20]=G;
		H1[20]=H;
		R2(A, B, C, D, E, F, G, H, 0xD8A7A879, W04, W04 ^ W08);
		W04 = EXPAND(W04, W11, W01, W07, W14);
		A1[21]=D;
		B1[21]=A;
		C1[21]=B;
		D1[21]=C;
		E1[21]=H;
		F1[21]=E;
		G1[21]=F;
		H1[21]=G;
		R2(D, A, B, C, H, E, F, G, 0xB14F50F3, W05, W05 ^ W09);
		W05 = EXPAND(W05, W12, W02, W08, W15);
		A1[22]=C;
		B1[22]=D;
		C1[22]=A;
		D1[22]=B;
		E1[22]=G;
		F1[22]=H;
		G1[22]=E;
		H1[22]=F;
		R2(C, D, A, B, G, H, E, F, 0x629EA1E7, W06, W06 ^ W10);
		W06 = EXPAND(W06, W13, W03, W09, W00);
		A1[23]=B;
		B1[23]=C;
		C1[23]=D;
		D1[23]=A;
		E1[23]=F;
		F1[23]=G;
		G1[23]=H;
		H1[23]=E;
		R2(B, C, D, A, F, G, H, E, 0xC53D43CE, W07, W07 ^ W11);
		W07 = EXPAND(W07, W14, W04, W10, W01);
		A1[24]=A;
		B1[24]=B;
		C1[24]=C;
		D1[24]=D;
		E1[24]=E;
		F1[24]=F;
		G1[24]=G;
		H1[24]=H;
		R2(A, B, C, D, E, F, G, H, 0x8A7A879D, W08, W08 ^ W12);
		W08 = EXPAND(W08, W15, W05, W11, W02);
		A1[25]=D;
		B1[25]=A;
		C1[25]=B;
		D1[25]=C;
		E1[25]=H;
		F1[25]=E;
		G1[25]=F;
		H1[25]=G;
		R2(D, A, B, C, H, E, F, G, 0x14F50F3B, W09, W09 ^ W13);
		W09 = EXPAND(W09, W00, W06, W12, W03);
		A1[26]=C;
		B1[26]=D;
		C1[26]=A;
		D1[26]=B;
		E1[26]=G;
		F1[26]=H;
		G1[26]=E;
		H1[26]=F;
		R2(C, D, A, B, G, H, E, F, 0x29EA1E76, W10, W10 ^ W14);
		W10 = EXPAND(W10, W01, W07, W13, W04);
		A1[27]=B;
		B1[27]=C;
		C1[27]=D;
		D1[27]=A;
		E1[27]=F;
		F1[27]=G;
		G1[27]=H;
		H1[27]=E;
		R2(B, C, D, A, F, G, H, E, 0x53D43CEC, W11, W11 ^ W15);
		W11 = EXPAND(W11, W02, W08, W14, W05);
		A1[28]=A;
		B1[28]=B;
		C1[28]=C;
		D1[28]=D;
		E1[28]=E;
		F1[28]=F;
		G1[28]=G;
		H1[28]=H;
		R2(A, B, C, D, E, F, G, H, 0xA7A879D8, W12, W12 ^ W00);
		W12 = EXPAND(W12, W03, W09, W15, W06);
		A1[29]=D;
		B1[29]=A;
		C1[29]=B;
		D1[29]=C;
		E1[29]=H;
		F1[29]=E;
		G1[29]=F;
		H1[29]=G;
		R2(D, A, B, C, H, E, F, G, 0x4F50F3B1, W13, W13 ^ W01);
		W13 = EXPAND(W13, W04, W10, W00, W07);
		A1[30]=C;
		B1[30]=D;
		C1[30]=A;
		D1[30]=B;
		E1[30]=G;
		F1[30]=H;
		G1[30]=E;
		H1[30]=F;
		R2(C, D, A, B, G, H, E, F, 0x9EA1E762, W14, W14 ^ W02);
		W14 = EXPAND(W14, W05, W11, W01, W08);
		A1[31]=B;
		B1[31]=C;
		C1[31]=D;
		D1[31]=A;
		E1[31]=F;
		F1[31]=G;
		G1[31]=H;
		H1[31]=E;
		R2(B, C, D, A, F, G, H, E, 0x3D43CEC5, W15, W15 ^ W03);
		W15 = EXPAND(W15, W06, W12, W02, W09);
		W[32]=W00;
		W[33]=W01;
		W[34]=W02;
		W[35]=W03;
		W[36]=W04;
		W[37]=W05;
		W[38]=W06;
		W[39]=W07;
		W[40]=W08;
		W[41]=W09;
		W[42]=W10;
		W[43]=W11;
		W[44]=W12;
		W[45]=W13;
		W[46]=W14;
		W[47]=W15;


		A1[32]=A;
		B1[32]=B;
		C1[32]=C;
		D1[32]=D;
		E1[32]=E;
		F1[32]=F;
		G1[32]=G;
		H1[32]=H;
		R2(A, B, C, D, E, F, G, H, 0x7A879D8A, W00, W00 ^ W04);
		W00 = EXPAND(W00, W07, W13, W03, W10);
		A1[33]=D;
		B1[33]=A;
		C1[33]=B;
		D1[33]=C;
		E1[33]=H;
		F1[33]=E;
		G1[33]=F;
		H1[33]=G;
		R2(D, A, B, C, H, E, F, G, 0xF50F3B14, W01, W01 ^ W05);
		W01 = EXPAND(W01, W08, W14, W04, W11);
		A1[34]=C;
		B1[34]=D;
		C1[34]=A;
		D1[34]=B;
		E1[34]=G;
		F1[34]=H;
		G1[34]=E;
		H1[34]=F;
		R2(C, D, A, B, G, H, E, F, 0xEA1E7629, W02, W02 ^ W06);
		W02 = EXPAND(W02, W09, W15, W05, W12);
		A1[35]=B;
		B1[35]=C;
		C1[35]=D;
		D1[35]=A;
		E1[35]=F;
		F1[35]=G;
		G1[35]=H;
		H1[35]=E;
		R2(B, C, D, A, F, G, H, E, 0xD43CEC53, W03, W03 ^ W07);
		W03 = EXPAND(W03, W10, W00, W06, W13);
		A1[36]=A;
		B1[36]=B;
		C1[36]=C;
		D1[36]=D;
		E1[36]=E;
		F1[36]=F;
		G1[36]=G;
		H1[36]=H;
		R2(A, B, C, D, E, F, G, H, 0xA879D8A7, W04, W04 ^ W08);
		W04 = EXPAND(W04, W11, W01, W07, W14);
		A1[37]=D;
		B1[37]=A;
		C1[37]=B;
		D1[37]=C;
		E1[37]=H;
		F1[37]=E;
		G1[37]=F;
		H1[37]=G;
		R2(D, A, B, C, H, E, F, G, 0x50F3B14F, W05, W05 ^ W09);
		W05 = EXPAND(W05, W12, W02, W08, W15);
		A1[38]=C;
		B1[38]=D;
		C1[38]=A;
		D1[38]=B;
		E1[38]=G;
		F1[38]=H;
		G1[38]=E;
		H1[38]=F;
		R2(C, D, A, B, G, H, E, F, 0xA1E7629E, W06, W06 ^ W10);
		W06 = EXPAND(W06, W13, W03, W09, W00);
		A1[39]=B;
		B1[39]=C;
		C1[39]=D;
		D1[39]=A;
		E1[39]=F;
		F1[39]=G;
		G1[39]=H;
		H1[39]=E;
		R2(B, C, D, A, F, G, H, E, 0x43CEC53D, W07, W07 ^ W11);
		W07 = EXPAND(W07, W14, W04, W10, W01);
		A1[40]=A;
		B1[40]=B;
		C1[40]=C;
		D1[40]=D;
		E1[40]=E;
		F1[40]=F;
		G1[40]=G;
		H1[40]=H;
		R2(A, B, C, D, E, F, G, H, 0x879D8A7A, W08, W08 ^ W12);
		W08 = EXPAND(W08, W15, W05, W11, W02);
		A1[41]=D;
		B1[41]=A;
		C1[41]=B;
		D1[41]=C;
		E1[41]=H;
		F1[41]=E;
		G1[41]=F;
		H1[41]=G;
		R2(D, A, B, C, H, E, F, G, 0x0F3B14F5, W09, W09 ^ W13);
		W09 = EXPAND(W09, W00, W06, W12, W03);
		A1[42]=C;
		B1[42]=D;
		C1[42]=A;
		D1[42]=B;
		E1[42]=G;
		F1[42]=H;
		G1[42]=E;
		H1[42]=F;
		R2(C, D, A, B, G, H, E, F, 0x1E7629EA, W10, W10 ^ W14);
		W10 = EXPAND(W10, W01, W07, W13, W04);
		A1[43]=B;
		B1[43]=C;
		C1[43]=D;
		D1[43]=A;
		E1[43]=F;
		F1[43]=G;
		G1[43]=H;
		H1[43]=E;
		R2(B, C, D, A, F, G, H, E, 0x3CEC53D4, W11, W11 ^ W15);
		W11 = EXPAND(W11, W02, W08, W14, W05);
		A1[44]=A;
		B1[44]=B;
		C1[44]=C;
		D1[44]=D;
		E1[44]=E;
		F1[44]=F;
		G1[44]=G;
		H1[44]=H;
		R2(A, B, C, D, E, F, G, H, 0x79D8A7A8, W12, W12 ^ W00);
		W12 = EXPAND(W12, W03, W09, W15, W06);
		A1[45]=D;
		B1[45]=A;
		C1[45]=B;
		D1[45]=C;
		E1[45]=H;
		F1[45]=E;
		G1[45]=F;
		H1[45]=G;
		R2(D, A, B, C, H, E, F, G, 0xF3B14F50, W13, W13 ^ W01);
		W13 = EXPAND(W13, W04, W10, W00, W07);
		A1[46]=C;
		B1[46]=D;
		C1[46]=A;
		D1[46]=B;
		E1[46]=G;
		F1[46]=H;
		G1[46]=E;
		H1[46]=F;
		R2(C, D, A, B, G, H, E, F, 0xE7629EA1, W14, W14 ^ W02);
		W14 = EXPAND(W14, W05, W11, W01, W08);
		A1[47]=B;
		B1[47]=C;
		C1[47]=D;
		D1[47]=A;
		E1[47]=F;
		F1[47]=G;
		G1[47]=H;
		H1[47]=E;
		R2(B, C, D, A, F, G, H, E, 0xCEC53D43, W15, W15 ^ W03);
		W15 = EXPAND(W15, W06, W12, W02, W09);
		W[48]=W00;
		W[49]=W01;
		W[50]=W02;
		W[51]=W03;
		W[52]=W04;
		W[53]=W05;
		W[54]=W06;
		W[55]=W07;
		W[56]=W08;
		W[57]=W09;
		W[58]=W10;
		W[59]=W11;
		W[60]=W12;
		W[61]=W13;
		W[62]=W14;
		W[63]=W15;


		A1[48]=A;
		B1[48]=B;
		C1[48]=C;
		D1[48]=D;
		E1[48]=E;
		F1[48]=F;
		G1[48]=G;
		H1[48]=H;
		R2(A, B, C, D, E, F, G, H, 0x9D8A7A87, W00, W00 ^ W04);
		W00 = EXPAND(W00, W07, W13, W03, W10);
		A1[49]=D;
		B1[49]=A;
		C1[49]=B;
		D1[49]=C;
		E1[49]=H;
		F1[49]=E;
		G1[49]=F;
		H1[49]=G;
		R2(D, A, B, C, H, E, F, G, 0x3B14F50F, W01, W01 ^ W05);
		W01 = EXPAND(W01, W08, W14, W04, W11);
		A1[50]=C;
		B1[50]=D;
		C1[50]=A;
		D1[50]=B;
		E1[50]=G;
		F1[50]=H;
		G1[50]=E;
		H1[50]=F;
		R2(C, D, A, B, G, H, E, F, 0x7629EA1E, W02, W02 ^ W06);
		W02 = EXPAND(W02, W09, W15, W05, W12);
		A1[51]=B;
		B1[51]=C;
		C1[51]=D;
		D1[51]=A;
		E1[51]=F;
		F1[51]=G;
		G1[51]=H;
		H1[51]=E;
		R2(B, C, D, A, F, G, H, E, 0xEC53D43C, W03, W03 ^ W07);
		W03 = EXPAND(W03, W10, W00, W06, W13);
		W[64]=W00;
		W[65]=W01;
		W[66]=W02;
		W[67]=W03;


		A1[52]=A;
		B1[52]=B;
		C1[52]=C;
		D1[52]=D;
		E1[52]=E;
		F1[52]=F;
		G1[52]=G;
		H1[52]=H;
		R2(A, B, C, D, E, F, G, H, 0xD8A7A879, W04, W04 ^ W08);
		A1[53]=D;
		B1[53]=A;
		C1[53]=B;
		D1[53]=C;
		E1[53]=H;
		F1[53]=E;
		G1[53]=F;
		H1[53]=G;
		R2(D, A, B, C, H, E, F, G, 0xB14F50F3, W05, W05 ^ W09);
		A1[54]=C;
		B1[54]=D;
		C1[54]=A;
		D1[54]=B;
		E1[54]=G;
		F1[54]=H;
		G1[54]=E;
		H1[54]=F;
		R2(C, D, A, B, G, H, E, F, 0x629EA1E7, W06, W06 ^ W10);
		A1[55]=B;
		B1[55]=C;
		C1[55]=D;
		D1[55]=A;
		E1[55]=F;
		F1[55]=G;
		G1[55]=H;
		H1[55]=E;
		R2(B, C, D, A, F, G, H, E, 0xC53D43CE, W07, W07 ^ W11);
		A1[56]=A;
		B1[56]=B;
		C1[56]=C;
		D1[56]=D;
		E1[56]=E;
		F1[56]=F;
		G1[56]=G;
		H1[56]=H;
		R2(A, B, C, D, E, F, G, H, 0x8A7A879D, W08, W08 ^ W12);
		A1[57]=D;
		B1[57]=A;
		C1[57]=B;
		D1[57]=C;
		E1[57]=H;
		F1[57]=E;
		G1[57]=F;
		H1[57]=G;
		R2(D, A, B, C, H, E, F, G, 0x14F50F3B, W09, W09 ^ W13);
		A1[58]=C;
		B1[58]=D;
		C1[58]=A;
		D1[58]=B;
		E1[58]=G;
		F1[58]=H;
		G1[58]=E;
		H1[58]=F;
		R2(C, D, A, B, G, H, E, F, 0x29EA1E76, W10, W10 ^ W14);
		A1[59]=B;
		B1[59]=C;
		C1[59]=D;
		D1[59]=A;
		E1[59]=F;
		F1[59]=G;
		G1[59]=H;
		H1[59]=E;
		R2(B, C, D, A, F, G, H, E, 0x53D43CEC, W11, W11 ^ W15);
		A1[60]=A;
		B1[60]=B;
		C1[60]=C;
		D1[60]=D;
		E1[60]=E;
		F1[60]=F;
		G1[60]=G;
		H1[60]=H;
		R2(A, B, C, D, E, F, G, H, 0xA7A879D8, W12, W12 ^ W00);
		A1[61]=D;
		B1[61]=A;
		C1[61]=B;
		D1[61]=C;
		E1[61]=H;
		F1[61]=E;
		G1[61]=F;
		H1[61]=G;
		R2(D, A, B, C, H, E, F, G, 0x4F50F3B1, W13, W13 ^ W01);
		A1[62]=C;
		B1[62]=D;
		C1[62]=A;
		D1[62]=B;
		E1[62]=G;
		F1[62]=H;
		G1[62]=E;
		H1[62]=F;
		R2(C, D, A, B, G, H, E, F, 0x9EA1E762, W14, W14 ^ W02);
		A1[63]=B;
		B1[63]=C;
		C1[63]=D;
		D1[63]=A;
		E1[63]=F;
		F1[63]=G;
		G1[63]=H;
		H1[63]=E;
		R2(B, C, D, A, F, G, H, E, 0x3D43CEC5, W15, W15 ^ W03);

		ctx->A ^= A;
		ctx->B ^= B;
		ctx->C ^= C;
		ctx->D ^= D;
		ctx->E ^= E;
		ctx->F ^= F;
		ctx->G ^= G;
		ctx->H ^= H;
		A1[64]=A;
		B1[64]=B;
		C1[64]=C;
		D1[64]=D;
		E1[64]=E;
		F1[64]=F;
		G1[64]=G;
		H1[64]=H;
		R2(A, B, C, D, E, F, G, H, 0x7A879D8A, W00, W00 ^ W04);
		printf("\n扩展后的消息：\n");
		for(i=0; i<68; i++) {
			printf("W[%02d]=%08x  ",i,W[i]);
			if(i%8==7) printf("\n");
		}
		printf("\n\n迭代压缩中间值：\n");
		printf(" j     A         B         C         D         E         F         G         H\n");
		printf("----------------------------------------------------------------------------------\n");
		for(i=0; i<=64; i++) {
			printf("%02d  ",i);
			printf("%08x  ",A1[i]);
			printf("%08x  ",B1[i]);
			printf("%08x  ",C1[i]);
			printf("%08x  ",D1[i]);
			printf("%08x  ",E1[i]);
			printf("%08x  ",F1[i]);
			printf("%08x  ",G1[i]);
			printf("%08x\n",H1[i]);
		}
	}
}

